import 'package:flutter/material.dart';
import 'package:yiyi_app_dome/models/wardrobe.dart';
import '../widget/home_page.dart';
import '../widget/login_page.dart';
import '../widget/main_page.dart';
import '../widget/register_page.dart';
import '../widget/ui/add_wardrode_page.dart';
import '../widget/ui/app_home_page.dart';
import '../widget/ui/ClothManagementPage.dart';
// import '../widget/add_wardwobe.dart';

final routes = {
  '/': (context) => HomePage(),
  '/login': (context) => LoginPage(),
  '/main': (context, {arguments}) => MainPage(),
  '/register': (context) => RegisterPage(),
  '/add_wardrobe': (context) => add_wardrobe_page(),
  '/app_home' : (context, {arguments}) => AppHomePage(arguments: arguments),
  '/cloth_management' : (context, {arguments, wardrobe}) => ClothManagementPage(arguments: arguments, wardrobe: wardrobe,)
};
//固定写法
var onGenerateRoute = (RouteSettings settings) {
  // 统一处理
  final String name = settings.name!;
  final Function pageContentBuilder = routes[name]!;
  if (pageContentBuilder != null) {
    if (settings.arguments != null) {
      final Route route = MaterialPageRoute(
          builder: (context) =>
              pageContentBuilder(context, arguments: settings.arguments));
      return route;
    } else {
      final Route route =
          MaterialPageRoute(builder: (context) => pageContentBuilder(context));
      return route;
    }
  }
};
